package com.hs.jhzd.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.hs.jhzd.entity.Equipment;

public interface EquipmentRepository extends JpaRepository<Equipment, Long> {
  public List<Equipment> findByJsbhOrderByJsh(String jsbh);

  public List<Equipment> findByJsbhAndType(String jsbh, String type);

  public List<Equipment> findByJsbhAndTypeAndSerialNo(String jsbh, String type, String serialNo);

  public Equipment findByJsbhAndIpAndType(String jsbh, String ip, String type);

  @Query("SELECT ip from Equipment where jsbh = :jsbh and jsh=:jsh and type=:type")
  public String findIpByDormCode(String jsbh, String jsh, String type);

  @Query("SELECT jsh from Equipment where jsbh = :jsbh and ip=:ip ")
  public String findDormCodeByIp(String jsbh, String ip);

}
